<!DOCTYPE html>
<html>
    <head>
        <title><?php $this->load->config('system_info');echo config_item('cfg_company')?>后台管理系统</title>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <link href="<?php echo base_url('data/share/themes/default/style.css') ?>" rel="stylesheet" type="text/css" media="screen"/>
        <link href="<?php echo base_url('data/share/themes/css/core.css') ?>" rel="stylesheet" type="text/css" media="screen"/>
        <link href="<?php echo base_url('data/share/themes/css/print.css') ?>" rel="stylesheet" type="text/css" media="print"/>
        <link href="<?php echo base_url('data/share/uploadify/css/uploadify.css') ?>" rel="stylesheet" type="text/css" media="screen"/>
        <!--[if IE]>
            <link href="<?php echo base_url('data/share/themes/css/ieHack.css') ?>" rel="stylesheet" type="text/css" media="screen"/>
        <![endif]-->
        <!--[if lte IE 9]>
        <script src="<?php echo base_url('data/share/js/speedup.js') ?>" type="text/javascript"></script>
        <![endif]-->
    </head>
    <body>
        <div id="layout">
            <div id="header">
                <div class="headerNav">
                    <a class="logo" href="<?php echo site_url('backend/main/index') ?>"></a>
                    <ul class="nav">
                        <li><a href="javascript:;" data-target="tiptip" data-title="上次登陆IP：<?php echo $last_login_ip; ?>"><span><?php echo $username; ?></span>，欢迎回来！</a></li>
                        <li><a href="<?php echo site_url('backend/admin/reset_password') ?>" target="dialog" width="600">修改密码</a></li>
                        <li><a href="<?php echo site_url('backend/main/logout'); ?>">退出</a></li>
                    </ul>
                    <ul class="themeList" id="themeList">
                        <li theme="default"><div class="selected">蓝色</div></li>
                        <li theme="green"><div>绿色</div></li>
                        <!--<li theme="red"><div>红色</div></li>-->
                        <li theme="purple"><div>紫色</div></li>
                        <li theme="silver"><div>银色</div></li>
                        <li theme="azure"><div>天蓝</div></li>
                    </ul>
                </div>

                <!-- navMenu -->

            </div>

            <div id="leftside">
                <div id="sidebar_s">
                    <div class="collapse">
                        <div class="toggleCollapse"><div></div></div>
                    </div>
                </div>
                <div id="sidebar">
                    <div class="toggleCollapse"><h2>主菜单</h2><div>收缩</div></div>

                    <div class="accordion" fillSpace="sidebar">
						<?php echo $header; ?>
                    </div>
                </div>
            </div>
            <div id="container">
                <div id="navTab" class="tabsPage">
                    <div class="tabsPageHeader">
                        <div class="tabsPageHeaderContent"><!-- 显示左右控制时添加 class="tabsPageHeaderMargin" -->
                            <ul class="navTab-tab">
                                <li tabid="main" class="main"><a href="javascript:;"><span><span class="home_icon">我的主页</span></span></a></li>
                            </ul>
                        </div>
                        <div class="tabsLeft">left</div><!-- 禁用只需要添加一个样式 class="tabsLeft tabsLeftDisabled" -->
                        <div class="tabsRight">right</div><!-- 禁用只需要添加一个样式 class="tabsRight tabsRightDisabled" -->
                        <div class="tabsMore">more</div>
                    </div>
                    <ul class="tabsMoreList">
                        <li><a href="javascript:;">我的主页</a></li>
                    </ul>
                    <div class="navTab-panel tabsPageContent layoutBox">
                        <div class="page unitBox">
                            <div class="accountInfo">
                                <div class="right">
                                    <p style="color:red">保留</p>
                                </div>
                                <p><span>SITENAME</span></p>
                                <p>介绍</p>
                            </div>
                            <div class="pageFormContent" layoutH="80" style='overflow: hidden;'>
								Welcome!
                            </div>
                        </div>

                    </div>
                </div>
            </div>
        </div>

        <div id="footer">Copyright &copy; 2014 - 2015 SITENAME</div>

		<div id="float-panel">
			<div class="tabs" currentIndex="0" eventType="click">
				<div class="tabsHeader">
					<div class="tabsHeaderContent">
						<a href="javascript:;" class="close">close</a>
						<ul>
							<li><a href="javascript:;"><span>超时未接单</span></a><badget>0</badget></li>
							<li><a href="javascript:;"><span>退款通知</span></a><badget>0</badget></li>
						</ul>
					</div>
				</div>
				<div class="tabsContent">
					<div>
						<ul class="overtime-notify-msg notify-msg">
						</ul>
					</div>
					<div>
						<ul class="refund-notify-msg notify-msg">
						</ul>
					</div>
				</div>
				<div class="tabsFooter">
					<div class="tabsFooterContent"></div>
				</div>
			</div>
		</div>
        <script src="<?php echo base_url('data/share/js/jquery-1.7.2.js') ?>" type="text/javascript"></script>
        <script src="<?php echo base_url('data/share/js/jquery.cookie.js') ?>" type="text/javascript"></script>
        <script src="<?php echo base_url('data/share/js/jquery.validate.js') ?>" type="text/javascript"></script>
        <script src="<?php echo base_url('data/share/js/jquery.bgiframe.js') ?>" type="text/javascript"></script>
        <script src="<?php echo base_url('data/share/xheditor/xheditor-1.2.1.min.js') ?>" type="text/javascript"></script>
        <script src="<?php echo base_url('data/share/xheditor/xheditor_lang/zh-cn.js') ?>" type="text/javascript"></script>
        <script src="<?php echo base_url('data/share/uploadify/scripts/jquery.uploadify.js') ?>" type="text/javascript"></script>

        <script src="<?php echo base_url('data/share/js/dwz.core.js') ?>" type="text/javascript"></script>
        <script src="<?php echo base_url('data/share/js/dwz.util.date.js') ?>" type="text/javascript"></script>
        <script src="<?php echo base_url('data/share/js/dwz.validate.method.js') ?>" type="text/javascript"></script>
        <script src="<?php echo base_url('data/share/js/dwz.barDrag.js') ?>" type="text/javascript"></script>
        <script src="<?php echo base_url('data/share/js/dwz.drag.js') ?>" type="text/javascript"></script>
        <script src="<?php echo base_url('data/share/js/dwz.tree.js') ?>" type="text/javascript"></script>
        <script src="<?php echo base_url('data/share/js/dwz.accordion.js') ?>" type="text/javascript"></script>
        <script src="<?php echo base_url('data/share/js/dwz.ui.js') ?>" type="text/javascript"></script>
        <script src="<?php echo base_url('data/share/js/dwz.theme.js') ?>" type="text/javascript"></script>
        <script src="<?php echo base_url('data/share/js/dwz.switchEnv.js') ?>" type="text/javascript"></script>
        <script src="<?php echo base_url('data/share/js/dwz.alertMsg.js') ?>" type="text/javascript"></script>
        <script src="<?php echo base_url('data/share/js/dwz.contextmenu.js') ?>" type="text/javascript"></script>
        <script src="<?php echo base_url('data/share/js/dwz.navTab.js') ?>" type="text/javascript"></script>
        <script src="<?php echo base_url('data/share/js/dwz.tab.js') ?>" type="text/javascript"></script>
        <script src="<?php echo base_url('data/share/js/dwz.resize.js') ?>" type="text/javascript"></script>
        <script src="<?php echo base_url('data/share/js/dwz.dialog.js') ?>" type="text/javascript"></script>
        <script src="<?php echo base_url('data/share/js/dwz.dialogDrag.js') ?>" type="text/javascript"></script>
        <script src="<?php echo base_url('data/share/js/dwz.sortDrag.js') ?>" type="text/javascript"></script>
        <script src="<?php echo base_url('data/share/js/dwz.cssTable.js') ?>" type="text/javascript"></script>
        <script src="<?php echo base_url('data/share/js/dwz.stable.js') ?>" type="text/javascript"></script>
        <script src="<?php echo base_url('data/share/js/dwz.taskBar.js') ?>" type="text/javascript"></script>
        <script src="<?php echo base_url('data/share/js/dwz.ajax.js') ?>" type="text/javascript"></script>
        <script src="<?php echo base_url('data/share/js/dwz.pagination.js') ?>" type="text/javascript"></script>
        <script src="<?php echo base_url('data/share/js/dwz.database.js') ?>" type="text/javascript"></script>
        <script src="<?php echo base_url('data/share/js/dwz.datepicker.js') ?>" type="text/javascript"></script>
        <script src="<?php echo base_url('data/share/js/dwz.effects.js') ?>" type="text/javascript"></script>
        <script src="<?php echo base_url('data/share/js/dwz.panel.js') ?>" type="text/javascript"></script>
        <script src="<?php echo base_url('data/share/js/dwz.checkbox.js') ?>" type="text/javascript"></script>
        <script src="<?php echo base_url('data/share/js/dwz.history.js') ?>" type="text/javascript"></script>
        <script src="<?php echo base_url('data/share/js/dwz.combox.js') ?>" type="text/javascript"></script>
        <script src="<?php echo base_url('data/share/js/dwz.print.js') ?>" type="text/javascript"></script>

        <!-- 可以用dwz.min.js替换前面全部dwz.*.js (注意：替换是下面dwz.regional.zh.js还需要引入)
        <script src="<?php echo base_url('data/share/js/dwz.min.js') ?>" type="text/javascript"></script>
        -->
        <script src="<?php echo base_url('data/share/js/dwz.regional.zh.js') ?>" type="text/javascript"></script>
		<script src="<?php echo base_url('data/share/js/jquery.tiptip.min.js') ?>" type="text/javascript"></script>	
		<script src="<?php echo base_url('data/share/js/jquery.fancybox.pack.js'); ?>" type="text/javascript"></script>	
		<script src="<?php echo base_url('data/share/js/jquery.editable.js'); ?>" type="text/javascript"></script>
		<script src="<?php echo base_url('data/share/js/jquery.amount.js') ?>" type="text/javascript"></script>
        <script type="text/javascript">
            function scheduled_work() {
                $.ajax({
                    url: '<?php echo site_url('backend/main/notify'); ?>',
                    cache: false,
                    type: 'post',
                    global: false,
                    dataType: 'json',
                    success: function (data) {
                        if (data.statusCode === 200) {
                            if (data.overtimePack.length > 0) {
                                var overtimePack = '';
                                for (var loop in data.overtimePack) {
                                    var pack = data.overtimePack[loop];
                                    var short_username = pack.username.split('|');
                                    var overtime = Math.floor((parseInt(new Date().getTime()) / 1000 - parseInt(pack.overtime)) / 60);
                                    overtimePack += '<li><dl class="late-alert">' + overtime + '分钟</dl><dl>单号: NO.' + pack.order_num + '</dl><dl>网点: ' + pack.address + '</dl><dl>店长电话: <a href="javascript:;" title="' + pack.username + '">' + short_username[0] + '</a></dl><div class="clearfix">&nbsp;<div></div></div></li>';
                                }
                                $('#float-panel .tabs .tabsContent .overtime-notify-msg').html(overtimePack);
                            }
                            $('#float-panel .tabs .tabsHeader ul li:eq(0) badget').text(data.overtimePack.length);
                            if (data.refundPack.length > 0) {
                                var refundPack = '';
                                for (var loop in data.refundPack) {
                                    var pack = data.refundPack[loop];
                                    var dateStr = new Date(parseInt(pack.created_at) * 1000);
                                    var request_time = dateStr.getFullYear() + '/' + dateStr.getMonth() + '/' + dateStr.getDate() + ' ' + dateStr.getHours() + ':' + dateStr.getMinutes() + ':' + dateStr.getSeconds();
                                    refundPack += '<li><dl class="late-alert">' + request_time + '</dl><dl>单号: NO.' + pack.order_num + '</dl><dl>网点: ' + pack.address + '</dl><dl>小哥电话: ' + pack.username + '</a></dl><div class="clearfix">&nbsp;<div></div></div></li>';
                                }
                                $('#float-panel .tabs .tabsContent .refund-notify-msg').html(refundPack);
                            }
                            $('#float-panel .tabs .tabsHeader ul li:eq(1) badget').text(data.refundPack.length);
                        }
                    }
                });
            }
            $(function () {
                DWZ.init("<?php echo base_url('data/share/dwz.frag.xml') ?>", {
//                    loginUrl: "<?php echo site_url('backend/login/index') ?>", loginTitle: "登录", // 弹出登录对话框
                    loginUrl: "<?php echo site_url('backend/login/index') ?>", // 跳到登录页面
                    statusCode: {ok: 200, error: 300, timeout: 301}, //【可选】
                    pageInfo: {pageNum: "pageNum", numPerPage: "numPerPage", orderField: "orderField", orderDirection: "orderDirection"}, //【可选】
                    keys: {statusCode: "statusCode", message: "message"}, //【可选】
                    ui: {hideMode: 'offsets'}, //【可选】hideMode:navTab组件切换的隐藏方式，支持的值有’display’，’offsets’负数偏移位置的值，默认值为’display’
                    debug: false, // 调试模式 【true|false】
                    callback: function () {
                        initEnv();
                        $("#themeList").theme({themeBase: "<?php echo base_url('data/share/themes') ?>"}); // themeBase 相对于index页面的主题base路径
                    }
                });
                DWZ.regPlugins.push(function ($p) {
                    if ($.fn.fancybox)
                        $('a[data-target=fancybox]', $p).fancybox({live: false});
                    if ($.fn.tiptip)
                        $('a[data-target=tiptip]', $p).tiptip({maxWidth: "auto", edgeOffset: 10});
                    if ($.fn.amount)
                        $('input.amount', $p).amount();
                    if ($.fn.editable)
                        $('td[data-target=editable]', $p).editable({hrefAttribute: "<?php echo site_url('backend/main/editable'); ?>"});
                });
                $("#float-panel .tabs .tabsHeader").dblclick(function () {
					var _this = $(this);
					if(_this.next().is)
                    _this.next().slideDown(1000, function(){
						$("#float-panel").animate({width:'400px'});
					});
					_this.find('.close').show();
                }).find('.close').click(function () {
                    $(this).hide().parents('.tabsHeader').next().slideUp('normal', function(){
						$("#float-panel").animate({width:'180px'});
					});
                });
                scheduled_work();
                setInterval('scheduled_work()', 10 * 1000);
            });
        </script>
	</body>
</html>
